console.log(1212);

function getadd(name: string, age: number = 20): string {
  console.log(age);
  return name;
}
getadd("1");

function tsChong(name: string): string;

function tsChong(age: number, num: number): number;

function tsChong(str: any): any {
  if (typeof str === "string") {
    console.log(str + "字符串");
  } else {
    console.log(str + "数字");
  }
}
tsChong(1, 1);
// ts 定义类的方法
class Person {
  public name: string;
  constructor(n: string) {
    this.name = n;
  }
  run(): void {
    console.log(this.name);
  }
}
const a = new Person("刘涵");
a.run();
console.log(a.name);
// ts 继承 关键字 extends 和 super 两个关键词
class Web extends Person {
  constructor(name: string) {
    super(name);
  }
}

const w = new Web("张三");
w.run();

/**
 * name
 */
// public name() {

// }
//protected (自身还有子应用可以访问的属性) private (私有的 有且只有自己可以访问的属性) public (公有的 都可以访问)

class per {
  public name: string;
  static sex = "男";
  constructor(name: string) {
    this.name = name;
  }

  static text() {
    console.log(this.sex);
  }
}
